using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

using FreeFlow.Administration;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for FieldControl.
	/// </summary>
  public class FieldControl : System.Windows.Forms.UserControl
  {
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label nameLabel;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox dataValueTextBox;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.TextBox whenChangedTextBox;
    private System.Windows.Forms.CheckBox isDependentCheck;
    private System.Windows.Forms.CheckBox autoRefillCheckBox;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.TextBox optionsLabel;
    private System.Windows.Forms.TextBox columnListLabel;
    private System.Windows.Forms.Label label5;
    private System.Windows.Forms.Label label6;
    private System.Windows.Forms.Label idLabel;
    private System.Windows.Forms.Label label7;
    private System.Windows.Forms.Label datasetLabel;
    /// <summary> 
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null;

    public FieldControl()
    {
      // This call is required by the Windows.Forms Form Designer.
      InitializeComponent();
    }

    /// <summary> 
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
      if( disposing )
      {
        if(components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

    #region Component Designer generated code
    /// <summary> 
    /// Required method for Designer support - do not modify 
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FieldControl));
      this.pictureBox1 = new System.Windows.Forms.PictureBox();
      this.label1 = new System.Windows.Forms.Label();
      this.nameLabel = new System.Windows.Forms.Label();
      this.label2 = new System.Windows.Forms.Label();
      this.dataValueTextBox = new System.Windows.Forms.TextBox();
      this.label3 = new System.Windows.Forms.Label();
      this.whenChangedTextBox = new System.Windows.Forms.TextBox();
      this.isDependentCheck = new System.Windows.Forms.CheckBox();
      this.autoRefillCheckBox = new System.Windows.Forms.CheckBox();
      this.label4 = new System.Windows.Forms.Label();
      this.optionsLabel = new System.Windows.Forms.TextBox();
      this.columnListLabel = new System.Windows.Forms.TextBox();
      this.label5 = new System.Windows.Forms.Label();
      this.label6 = new System.Windows.Forms.Label();
      this.idLabel = new System.Windows.Forms.Label();
      this.label7 = new System.Windows.Forms.Label();
      this.datasetLabel = new System.Windows.Forms.Label();
      this.SuspendLayout();
      // 
      // pictureBox1
      // 
      this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
      this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
      this.pictureBox1.Location = new System.Drawing.Point(344, 8);
      this.pictureBox1.Name = "pictureBox1";
      this.pictureBox1.Size = new System.Drawing.Size(32, 32);
      this.pictureBox1.TabIndex = 0;
      this.pictureBox1.TabStop = false;
      // 
      // label1
      // 
      this.label1.Location = new System.Drawing.Point(8, 8);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(40, 16);
      this.label1.TabIndex = 1;
      this.label1.Text = "Name:";
      // 
      // nameLabel
      // 
      this.nameLabel.Location = new System.Drawing.Point(94, 8);
      this.nameLabel.Name = "nameLabel";
      this.nameLabel.Size = new System.Drawing.Size(208, 16);
      this.nameLabel.TabIndex = 2;
      this.nameLabel.Text = "nameLabel";
      // 
      // label2
      // 
      this.label2.Location = new System.Drawing.Point(8, 40);
      this.label2.Name = "label2";
      this.label2.Size = new System.Drawing.Size(64, 16);
      this.label2.TabIndex = 3;
      this.label2.Text = "Data value:";
      // 
      // dataValueTextBox
      // 
      this.dataValueTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.dataValueTextBox.Location = new System.Drawing.Point(96, 40);
      this.dataValueTextBox.Multiline = true;
      this.dataValueTextBox.Name = "dataValueTextBox";
      this.dataValueTextBox.ReadOnly = true;
      this.dataValueTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.dataValueTextBox.Size = new System.Drawing.Size(248, 80);
      this.dataValueTextBox.TabIndex = 4;
      this.dataValueTextBox.Text = "dataValueTextBox";
      // 
      // label3
      // 
      this.label3.Location = new System.Drawing.Point(8, 128);
      this.label3.Name = "label3";
      this.label3.Size = new System.Drawing.Size(88, 16);
      this.label3.TabIndex = 5;
      this.label3.Text = "When changed:";
      // 
      // whenChangedTextBox
      // 
      this.whenChangedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.whenChangedTextBox.Location = new System.Drawing.Point(96, 128);
      this.whenChangedTextBox.Multiline = true;
      this.whenChangedTextBox.Name = "whenChangedTextBox";
      this.whenChangedTextBox.ReadOnly = true;
      this.whenChangedTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.whenChangedTextBox.Size = new System.Drawing.Size(248, 80);
      this.whenChangedTextBox.TabIndex = 6;
      this.whenChangedTextBox.Text = "whenChangedTextBox";
      // 
      // isDependentCheck
      // 
      this.isDependentCheck.Enabled = false;
      this.isDependentCheck.Location = new System.Drawing.Point(8, 216);
      this.isDependentCheck.Name = "isDependentCheck";
      this.isDependentCheck.TabIndex = 9;
      this.isDependentCheck.Text = "Is dependent";
      // 
      // autoRefillCheckBox
      // 
      this.autoRefillCheckBox.Enabled = false;
      this.autoRefillCheckBox.Location = new System.Drawing.Point(8, 240);
      this.autoRefillCheckBox.Name = "autoRefillCheckBox";
      this.autoRefillCheckBox.TabIndex = 10;
      this.autoRefillCheckBox.Text = "Auto-refill";
      // 
      // label4
      // 
      this.label4.Location = new System.Drawing.Point(8, 264);
      this.label4.Name = "label4";
      this.label4.Size = new System.Drawing.Size(72, 16);
      this.label4.TabIndex = 11;
      this.label4.Text = "Options:";
      // 
      // optionsLabel
      // 
      this.optionsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.optionsLabel.Location = new System.Drawing.Point(96, 264);
      this.optionsLabel.Multiline = true;
      this.optionsLabel.Name = "optionsLabel";
      this.optionsLabel.ReadOnly = true;
      this.optionsLabel.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.optionsLabel.Size = new System.Drawing.Size(248, 80);
      this.optionsLabel.TabIndex = 12;
      this.optionsLabel.Text = "optionsLabel";
      // 
      // columnListLabel
      // 
      this.columnListLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.columnListLabel.Location = new System.Drawing.Point(96, 352);
      this.columnListLabel.Multiline = true;
      this.columnListLabel.Name = "columnListLabel";
      this.columnListLabel.ReadOnly = true;
      this.columnListLabel.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
      this.columnListLabel.Size = new System.Drawing.Size(248, 80);
      this.columnListLabel.TabIndex = 13;
      this.columnListLabel.Text = "columnListLabel";
      // 
      // label5
      // 
      this.label5.Location = new System.Drawing.Point(8, 352);
      this.label5.Name = "label5";
      this.label5.Size = new System.Drawing.Size(72, 16);
      this.label5.TabIndex = 14;
      this.label5.Text = "Column list:";
      // 
      // label6
      // 
      this.label6.Location = new System.Drawing.Point(8, 24);
      this.label6.Name = "label6";
      this.label6.Size = new System.Drawing.Size(56, 16);
      this.label6.TabIndex = 15;
      this.label6.Text = "ID:";
      // 
      // idLabel
      // 
      this.idLabel.Location = new System.Drawing.Point(96, 24);
      this.idLabel.Name = "idLabel";
      this.idLabel.Size = new System.Drawing.Size(100, 16);
      this.idLabel.TabIndex = 16;
      this.idLabel.Text = "idLabel";
      // 
      // label7
      // 
      this.label7.Location = new System.Drawing.Point(8, 440);
      this.label7.Name = "label7";
      this.label7.Size = new System.Drawing.Size(72, 16);
      this.label7.TabIndex = 17;
      this.label7.Text = "Dataset:";
      // 
      // datasetLabel
      // 
      this.datasetLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      this.datasetLabel.Location = new System.Drawing.Point(96, 440);
      this.datasetLabel.Name = "datasetLabel";
      this.datasetLabel.Size = new System.Drawing.Size(248, 16);
      this.datasetLabel.TabIndex = 18;
      this.datasetLabel.Text = "datasetLabel";
      // 
      // FieldControl
      // 
      this.Controls.Add(this.datasetLabel);
      this.Controls.Add(this.label7);
      this.Controls.Add(this.idLabel);
      this.Controls.Add(this.label6);
      this.Controls.Add(this.label5);
      this.Controls.Add(this.columnListLabel);
      this.Controls.Add(this.optionsLabel);
      this.Controls.Add(this.label4);
      this.Controls.Add(this.autoRefillCheckBox);
      this.Controls.Add(this.isDependentCheck);
      this.Controls.Add(this.whenChangedTextBox);
      this.Controls.Add(this.label3);
      this.Controls.Add(this.dataValueTextBox);
      this.Controls.Add(this.label2);
      this.Controls.Add(this.nameLabel);
      this.Controls.Add(this.label1);
      this.Controls.Add(this.pictureBox1);
      this.Name = "FieldControl";
      this.Size = new System.Drawing.Size(384, 472);
      this.ResumeLayout(false);

    }
    #endregion

    public void LoadField(Field field)
    {
      nameLabel.Text = field.Name;
      dataValueTextBox.Text = field.DataValue;
      whenChangedTextBox.Text = field.WhenChanged;
      isDependentCheck.Checked = field.IsDependent;
      autoRefillCheckBox.Checked = field.AutoRefill;
      optionsLabel.Text = field.Options;
      columnListLabel.Text = field.ColumnList;
      idLabel.Text = field.Id.ToString();
      datasetLabel.Text = field.DataSet;
    }
	}
}
